<?php

Solar::loadClass('Solar_Base');

class Domain51_Service_Delicious extends Solar_Base
{
    protected $_Domain51_Service_Delicious = array(
        'username' => '',
        'password' => ''
    );
    
    protected $_connection = null;
    
    public function __construct($config = null) {
        parent::__construct($config);
        
        $connection_config = $this->_config;
        $connection_config['service_url'] = 'https://api.del.icio.us/v1/';
        
        $this->_connection = Solar::factory(
            'Domain51_Util_Service_Connection',
            $connection_config
        );
    }

    public function __call($method, $arguments) {
        switch ($method) {
            case 'tags' :
            case 'posts' :
            case 'update' :
            case 'bundles' :
                $adapter = ucwords($method);
                break;
            
            default:
                throw $this->_exception('Unknown method request');
        }
        
        $adapterClass = 'Domain51_Service_Delicious_' . $adapter;
        Solar::loadClass($adapterClass);
        return new $adapterClass($this->_connection); 
    }
}

?>